<?php
require_once($_SERVER["DOCUMENT_ROOT"].'/outils/writerJSON/JSON.php');

class WriterJSON {
	public static function echoSuccess($message) {
		$json = new Services_JSON();
		$result = array("succes" => true, "detail" => "<font color='green'>$message</font>");
		print($json->encode($result));
	}
	
	public static function echoSuccessState() {
		$json = new Services_JSON();
		$result = array("succes" => true);
		print($json->encode($result));
	}
	
	public static function echoError($message) {
		$json = new Services_JSON();
		$result = array("succes" => false, "detail" => "<font color='red'>$message</font>");
		print($json->encode($result));
	}
	
	public static function echoDonnees($tableauChamps, $succes=true) {
		$json = new Services_JSON();
		$tableauChamps["succes"]=$succes;
		print($json->encode($tableauChamps));
	}
}
?>